import { mongo } from "../mogoConfig";


const run = async () => {
    const restaurantTB = mongo.db("sample_restaurants").collection("restaurants")

    let cursor = await restaurantTB.distinct("borough",{},{collation:{locale:"zh"}})

    console.log("不带条件-------------------")
    for await (const item of cursor) {
        console.log(JSON.stringify(item, null, 2))
    }

    cursor = await restaurantTB.distinct("borough", { borough: { $ne: "Bronx" } })

    console.log("带条件-------------------")
    for await (const item of cursor) {
        console.log(JSON.stringify(item, null, 2))
    }

}



run()
    .catch(error => {
        console.log(error)
    })
    .finally(() => {
        console.log("执行结束")
        mongo.close()
    })
